package com.itheima.edu.info.manager.day16;

import java.lang.reflect.Method;

public class ClassTest4 {
    public static void main(String[] args) throws NoSuchMethodException {
        //  declaredMethods();


        //  declaredMethod();


       //  method();

        //获取此对象的所有方法包括继承方法
         methods();
    }

    private static void declaredMethods() {
        Class c = Student.class;
        Method[] declaredMethods = c.getDeclaredMethods();
        for (Method declaredMethod : declaredMethods) {
            System.out.println(declaredMethod);
        }
    }

    private static void declaredMethod() throws NoSuchMethodException {
        Class c = Student.class;
        Method show = c.getDeclaredMethod("show");
        System.out.println(show);
    }

    private static void methods() {
     //   Class c = Student.class;
        Class c=Method.class;
        Method[] methods = c.getMethods();
        for (Method method : methods) {
            System.out.println(method);
        }
    }

    private static void method() throws NoSuchMethodException {
        Class c = Student.class;
        Method function1 = c.getMethod("function1");
        System.out.println(function1);
    }
}
